package com.seelyn.ddvideo.model;

import com.seelyn.ddvideo.spider.FromSiteEnum;
import org.springframework.data.annotation.Id;

import java.util.ArrayList;
import java.util.List;

/**
 * @author slacrey
 * @since 2017/6/10
 */
public class Video {

    @Id
    private String id;
    private String vid;//影片播放编号
    private String title;//影片名称
    @Deprecated
    private String fromSite;//来源网站
    private String remarks;//影片简介
    private String picUrl;//缩略图
    private Integer playCount;//总级数
    private Float score;//评分
    private List<VideoPlayer> players = new ArrayList<>();
    private List<VideoFrom> videoFroms = new ArrayList<>();
    private Integer movieType;
    private Long createTime;
    private Long onlineTime;
    private boolean delFlag;
    private String updateText;
    private String createBy;
    private Integer subType;
    private Integer vipType;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getVid() {
        return vid;
    }

    public void setVid(String vid) {
        this.vid = vid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getFromSite() {
        return fromSite;
    }

    public void setFromSite(String fromSite) {
        this.fromSite = fromSite;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public Integer getPlayCount() {
        return playCount;
    }

    public void setPlayCount(Integer playCount) {
        this.playCount = playCount;
    }

    public Float getScore() {
        return score;
    }

    public void setScore(Float score) {
        this.score = score;
    }

    public List<VideoPlayer> getPlayers() {
        return players;
    }

    public void setPlayers(List<VideoPlayer> players) {
        this.players = players;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Integer getMovieType() {
        return movieType;
    }

    public void setMovieType(Integer movieType) {
        this.movieType = movieType;
    }

    public Long getOnlineTime() {
        return onlineTime;
    }

    public void setOnlineTime(Long onlineTime) {
        this.onlineTime = onlineTime;
    }

    public boolean isDelFlag() {
        return delFlag;
    }

    public void setDelFlag(boolean delFlag) {
        this.delFlag = delFlag;
    }

    public String getUpdateText() {
        return updateText;
    }

    public void setUpdateText(String updateText) {
        this.updateText = updateText;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public List<VideoFrom> getVideoFroms() {
        return videoFroms;
    }

    public void setVideoFroms(List<VideoFrom> videoFroms) {
        this.videoFroms = videoFroms;
    }

    public List<VideoPlayer> getPlayers(FromSiteEnum fromSiteEnum) {
        for (VideoFrom from : videoFroms) {
            if (fromSiteEnum.name().equals(from.getFromSite())) {
                return from.getPlayers();
            }
        }
        videoFroms.add(new VideoFrom(fromSiteEnum));

        return getPlayers(fromSiteEnum);
    }

    public Integer getSubType() {
        return subType;
    }

    public void setSubType(Integer subType) {
        this.subType = subType;
    }

    public Integer getVipType() {
        return vipType;
    }

    public void setVipType(Integer vipType) {
        this.vipType = vipType;
    }
}
